Getting name of object on other end of a link.

My setup is this.

Requirement  -> (linked to) -> Sub Requirement

Explanation: I have a Main Requirement that is then linked to multiple Sub Requirements all in the same module

 

I'm trying to write a DXL script that when ran, will find all the sub requirements linked to a specific requirement and then print them out.

So what I want my results to look like is:

Requirement Name - Requirement Text

Sub Requirement Name - Sub Requirement Text

 

What I'm struggling with is when I have no idea how to get the information at the other end of a link. I have read the DXL resource guide over and over and can't find any assistance. Anyone have any code they can share or help me out. Note: I am a horrible coder, very little experience but I often have an upward of 50 sub requirements per main requirement so clinking a bunch of links to copy and paste is a huge waste of time.


Cmagru2 - Mon Sep 29 14:18:10 EDT 2014

Re: Getting name of object on other end of a link.
llandale - Mon Sep 29 15:26:52 EDT 2014

The wizard should work.  One of the later screens asks what attributes about the "other" object you want to display.  Presumably the "Requirement Name" is an attribute.

If for whatever reason you need to figure out the "Requirement Name", you can use the wizard to display the Text, then edit the DXL itself.  Where it displays the text you can get a handle on that other object (perhaps variable "othero"), and then add whatever code you need to determine the Name.

Seems to me you would want to add some sort of:

  • if (module(obj) != module(othero))  then continue

-Louie

In general, though:

  • The Module of the other Object must be open.
    • For inlinks, that other module must be open first (via "LinkRefs") before you even see the "Link".  So you can get the "source" object of the link: othero = source(lnk)
    • For outlinks, you see the Link but need to open the other Module, then get the target object of theLink.
  • Once you have an "Object" handle on that other object, gather what you need to know about it.

Re: Getting name of object on other end of a link.
mcnairk - Tue Sep 30 09:52:43 EDT 2014

Are you trying to display the results in a DXL layout column or a report generated on request?

Ken.